import { getListSearch } from "@/api"

export default {
  namespaced: true,
  state: {
    searchList: {},
  },
  getters: {
    trademarkList(state) {
      return state.searchList.trademarkList
    },
    attrsList(state) {
      return state.searchList.attrsList
    },
    goodsList(state) {
      return state.searchList.goodsList
    },
    total(state) {
      return state.searchList.total
    },
  },
  actions: {
    async getList({ commit }, query) {
      const result = await getListSearch(query)
      if (result.code === 200) {
        commit("GET_LIST", result.data)
      } else {
        console.log(result.message)
      }
    },
  },
  mutations: {
    GET_LIST(state, data) {
      state.searchList = data
    },
  },
}
